server: fix failed to remove template/iso if upload from local fails#4626
Conversation
When upload template/iso/volume from local fails, the install_path will not be a full path of file so removing it will fail. ``` mysql> select install_path from template_store_ref; +--------------------------------------------------------------------+ | install_path | +--------------------------------------------------------------------+ | template/tmpl/1/3/805f4763-248e-40ec-b79a-b868cc480d0a.qcow2 | | template/tmpl/1/4/c7e32c9e-5e72-3726-85cf-aa5ccd84118d.qcow2 | | template/tmpl/2/201/bc4f4f08-138a-31b8-af1a-d4450eff7982.qcow2 | | template/tmpl/2/202 | | template/tmpl/2/203/203-2-d47f8cde-a2a8-31e7-a826-2628ad98a6c8.iso | | template/tmpl/2/204 | | template/tmpl/5/205 | | template/tmpl/2/206 | | template/tmpl/2/207 | | template/tmpl/2/208 | | template/tmpl/2/209 | | template/tmpl/2/210 | +--------------------------------------------------------------------+ 12 rows in set (0.00 sec) mysql> select install_path from volume_store_ref; +---------------------------------------------------------+ | install_path | +---------------------------------------------------------+ | volumes/2/22 | | volumes/2/19/f93face9-6521-4184-b89a-cb07f86bbae8.qcow2 | | volumes/2/23 | | volumes/2/24 | +---------------------------------------------------------+ 4 rows in set (0.00 sec) ```
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2612 |
|
@blueorangutan test centos7 vmware-67u3 |
|
@shwstppr a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests |
|
Trillian test result (tid-3453)
|
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-3472)
|
shwstppr
left a comment
There was a problem hiding this comment.
@ustcweizhou Local upload failed with a message,
Failed to upload file due to system misconfiguration. Please contact admin.
Now with changes, I cannot delete the template with message,
The template is either getting uploaded or it may be initiated shortly, please wait for it to be completed
Is this desired? I think we can allow deleting when it is in NotUploaded state
@shwstppr NotUploaded is the initialed state of volumes/template/iso when it is uploaded from local. I think deleting template/iso in NotUploaded state should not be allowed (same as volumes). |
Pearl1594
left a comment
There was a problem hiding this comment.
Verified behavior. LGTM
|
ping @ustcweizhou @shwstppr @Pearl1594 - should we merge this on 4.14 now, or change base/milestone to 4.15.1.0? |
…pache#4626) * server: fix failed to remove template/iso if upload from local fails When upload template/iso/volume from local fails, the install_path will not be a full path of file so removing it will fail. ``` mysql> select install_path from template_store_ref; +--------------------------------------------------------------------+ | install_path | +--------------------------------------------------------------------+ | template/tmpl/1/3/805f4763-248e-40ec-b79a-b868cc480d0a.qcow2 | | template/tmpl/1/4/c7e32c9e-5e72-3726-85cf-aa5ccd84118d.qcow2 | | template/tmpl/2/201/bc4f4f08-138a-31b8-af1a-d4450eff7982.qcow2 | | template/tmpl/2/202 | | template/tmpl/2/203/203-2-d47f8cde-a2a8-31e7-a826-2628ad98a6c8.iso | | template/tmpl/2/204 | | template/tmpl/5/205 | | template/tmpl/2/206 | | template/tmpl/2/207 | | template/tmpl/2/208 | | template/tmpl/2/209 | | template/tmpl/2/210 | +--------------------------------------------------------------------+ 12 rows in set (0.00 sec) mysql> select install_path from volume_store_ref; +---------------------------------------------------------+ | install_path | +---------------------------------------------------------+ | volumes/2/22 | | volumes/2/19/f93face9-6521-4184-b89a-cb07f86bbae8.qcow2 | | volumes/2/23 | | volumes/2/24 | +---------------------------------------------------------+ 4 rows in set (0.00 sec) ``` * server: disallow removing template/iso in NotUpload and UploadInProgress state
Description
This PR fixes the issue that failed to remove template/iso if upload from local fails
When upload template/iso/volume from local fails, the install_path will not be a full path of file so removing it will fail.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?